package com.bzsg.simpleMediaPlayer.learn

import androidx.compose.runtime.mutableIntStateOf
import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class CounterViewModel
    @Inject
    constructor() : ViewModel() {
        private val _counter = mutableIntStateOf(0)
        val counter = _counter

        fun increment() {
            _counter.value += 1
        }

        fun decrement() {
            if (_counter.value > 1) {
                _counter.value -= 1
            }
        }
    }
